<link rel="stylesheet" href="__PUBLIC__/admin/css/bootstrap.css">
<style type="text/css">
    element.style {
        display: block;
        padding-right: 17px;
    }
    .modal-open .modal {
        overflow-x: hidden;
        overflow-y: auto;
    }
    .modal {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1050;
        display: none;
        outline: 0;
    }
</style>
<div class="content"> 
                <div class="operation">
                    <div class="pull-left">
                        <a href="/Admin/Audit/index?status=1"><button data-toggle="modal" data-target=".bs-example-modal-lg"><span class="glyphicon glyphicon-plus"></span>未审核</button></a>
                        <a href="/Admin/Audit/index?status=2"><button data-toggle="modal" data-target=".bs-example-modal-lg"><span class="glyphicon glyphicon-plus"></span>通过</button></a>
                        <a href="/Admin/Audit/index?status=3"><button data-toggle="modal" data-target=".bs-example-modal-lg"><span class="glyphicon glyphicon-plus"></span>未通过</button></a>
                       <!--  <select name="status">
                            <option value="0">未审核</option>
                            <option value="1">已通过</option>
                            <option value="2">未通过</option>
                        </select>
   -->
                    </div>
                    <div class="right-box">
                        <input type="search" placeholder="代理商客户关键词搜索..." name="search" class="search" value="{$search}">
                        <span class="glyphicon glyphicon-search" id="sub"></span>
                    </div>
                </div>
                <table class="table">
                    <tbody>
                    <tr>
                        <volist name="header" id="vo">
                            <th>{$vo}
                                <span>
                                    <a class="glyphicon glyphicon-triangle-top"></a>
                                    <a class="glyphicon glyphicon-triangle-bottom"></a>
                                </span>
                            </th>
                        </volist>
                        <th>操作
                            <span>
                                <a class="glyphicon glyphicon-triangle-top"></a>
                                <a class="glyphicon glyphicon-triangle-bottom"></a>
                            </span>
                        </th>
                    </tr>
                        <volist name="list" id="vo">
                        <tr>
                            <volist name="vo" id="v">
                                <td>{$v}</td>
                            </volist>
                            <td>
                                <a  href="{:U('Admin/Audit/handle',array('act'=>'2','id'=>$vo['id']))}" >通过</a>
                                <a  href="{:U('Admin/Audit/handle',array('act'=>'3','id'=>$vo['id']))}">不通过</a>
                            </td>
                        </tr>
                        </volist>       
                </tbody>
            </table>
                <div class="page">
                    <span>共 {$count} 条</span>
                    <div class="paging">
                        {$page}
                    </div>
                    前往<input type="text" value="{$p}" name='page' onchange="mychange()">页
                </div>    
            </div>
            <div class="modal fade bs-example-modal-lg">
            <div class="modal-dialog modal-lg">

                <div class="modal-content" style="padding: 30px 0 76px 30px">
                    <h3>需要审核的关键词：</h3>
                    <textarea  class='kwdlist'></textarea>
                    <div class="platform">
                        <h3>请选择需要优化的搜索平台</h3>
                        <div>
                            <p>pc端&nbsp;&nbsp;&nbsp; <input type="checkbox" name="seo[]" v="1"   />百度<input type="checkbox" name="seo[]" v="2"  />360 <input type="checkbox" name="seo[]" v="3"  />搜狗 </p>
                            <p>移动端 <input type="checkbox" name="seo[]" v="4"  />百度<input type="checkbox" name="seo[]" v="5"  />360 <input type="checkbox" name="seo[]" v="6"  />搜狗 </p>
                        </div>
                    </div>
                    <div class="add-information">
                        <h3>添加你要优化的站点及FTP信息<span>(添加FTP信息将更有利于网站优化)</span></h3>
                        <div class="add-information-list">
                           <div>
                                <label>站点</label>
                                <input type="text" placeholder="www.baidu.com" name="site">
                            </div>
                            <div>
                                <label>FTP IP</label>
                                <input type="text" placeholder="请输入FTP IP" name="ftp_ip">
                            </div>
                            <div>
                                <label>FTP用户名</label>
                                <input type="text" placeholder="请输入FTP用户名" name="username">
                            </div>
                            <div>
                                <label>FTP 密码</label>
                                <input type="text" placeholder="请输入FTP密码" name="password">
                            </div>
                            <div>
                                <label>网站后台地址</label>
                                <input type="text" placeholder="请输入网站后台地址" style="width:205px;" name="adminadd">
                            </div>
                            <div>
                                <label>后台用户名</label>
                                <input type="text" placeholder="请输入网站后台用户名" style="width:205px;" name="adminusername">
                            </div>
                            <div>
                                <label>后台密码</label>
                                <input type="text" placeholder="请输入网站后台密码" style="width:205px;" name="adminpassword">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
<script type="text/javascript">
    $("#sub").click(function(){
        var search = $('.search').val();
        window.location.href = "/Admin/Audit/index.html?search="+search;
    });

    function mychange(){
      var page =  $('input[name="page"]').val();
      window.location.href = "/index.php/Admin/Audit/index/p/"+page;
    }

    document.onclick = function(e) {
        var modal = 　$('.modal').css('display');
        // console.log(modal);
        if(modal == 'block'){
            $('.modal').css('display','none');
            $(".modal").removeClass("show");
            $("body").removeClass("modal-open");
            $("body").css("padding-right",'0');
            $(".modal-backdrop").remove();
        }　　　　　
    }


    $(".details").click(function(){

        var query_id = $(this).attr('query_id');
        $.ajax({
            url:'/Admin/Audit/query',    //请求的url地址
            dataType: "JSON",   //返回格式为json
            async: true,//请求是否异步，默认为异步，这也是ajax重要特性
            type: "post",   //请求方式
            data:{
                query_id:query_id,
            },

            success: function (data) {
                if(data.state==1){
                    // console.log(data.data)
                    $.each(data.data, function (i, item) {
                        // console.log(i);
                        $('input[name='+i+']').val(item);
                    });

                    $.each(data.seo, function (i, item) {
                        $("input[v="+item+"]").attr("checked",true);
                    });
                    // console.log(data.name);
                    // console.log(data.kwdlist);
                    // $('input[name=kwdlist]').val(data.kwdlist);
                    $('.kwdlist').html(data.kwdlist);

                }else{
                    console.log(data.data)
                    window.location.reload();
                }
            }
        })

        $("body").addClass("modal-open");
        $(".modal").addClass("show");
        $('.modal').css('display','block');
        $("body").append("<div class='modal-backdrop fade show'></div>");

    });
    
    $(".modal-content").click(function(event){
        event.stopPropagation();
    });

    $(".details").click(function(event){
        event.stopPropagation();
    });
</script>